using System;
using System.Text;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using OVS.BusinessObjects;

namespace OVS.DAL
{
    public partial class Image_HaarDAO
	{
        public Image_Haar GetImage_Haar_ByNom(String imha_desc)
        {
            try
            {
                Image_Haar oImage_Haar = new Image_Haar();
                DbCommand oDbCommand = DbProviderHelper.CreateCommand("SELECT [imha_id],[imha_fn],[imha_label],[imha_height],[imha_width],[imha_desc] FROM [Image_Haar] WHERE [imha_desc]=@imha_desc", CommandType.Text);
                oDbCommand.Parameters.Add(DbProviderHelper.CreateParameter("@imha_desc", DbType.String, imha_desc));
                DbDataReader oDbDataReader = DbProviderHelper.ExecuteReader(oDbCommand);
                while (oDbDataReader.Read())
                {
                    oImage_Haar.imha_id = Convert.ToInt32(oDbDataReader["imha_id"]);
                    oImage_Haar.imha_fn = Convert.ToString(oDbDataReader["imha_fn"]);

                    if (oDbDataReader["imha_label"] != DBNull.Value)
                        oImage_Haar.imha_label = Convert.ToString(oDbDataReader["imha_label"]);

                    if (oDbDataReader["imha_height"] != DBNull.Value)
                        oImage_Haar.imha_height = Convert.ToInt32(oDbDataReader["imha_height"]);

                    if (oDbDataReader["imha_width"] != DBNull.Value)
                        oImage_Haar.imha_width = Convert.ToInt32(oDbDataReader["imha_width"]);

                    if (oDbDataReader["imha_desc"] != DBNull.Value)
                        oImage_Haar.imha_desc = Convert.ToString(oDbDataReader["imha_desc"]);
                }
                oDbDataReader.Close();
                return oImage_Haar;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
       
        
	}
}
